package introspector;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;

public class MyBean {
//	private String NAMEU;
	private String name;
	
	public MyBean(String nameu, String name) {
		super();
//		NAMEU = nameu;
		this.name = name;
	}
	/**
	 * @return the nAMEU
	 */
//	public String getNAMEU() {
//		return "NAMEU";
//	}
	/**
	 * @param nameu the nAMEU to set
	 */
//	public void setNAMEU(String nameu) {
//		NAMEU = nameu;
//	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	public static void main(String[] args) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
		MyBean mb = new MyBean("upper", "name");
		BeanInfo bi = Introspector.getBeanInfo(mb.getClass(), Object.class);
		PropertyDescriptor[] props = bi.getPropertyDescriptors();
        for ( int i=0;i<props.length;i++){
            System.out.println(props[i].getName()+ "=" +
                    props[i].getReadMethod().invoke(mb, null));
        }
	}
}
